//old scholl js
function showHideTbar(obj,e){
	if(!e){
		e=window.event;
	}
    if (e.target.type!= 'checkbox'){
		if (obj.style.display=='none'){
				obj.style.display='block';
			}
		else{
				obj.style.display='none';
			}	
	}
	return false;
}
function SetOpacity(object,opacityPct)
{
  // IE.
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  // Old mozilla and firefox
  object.style.MozOpacity = opacityPct/100;
  // Everything else.
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}
function FadeIn(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100)",1);
}
function FadeOut(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",100,0)",1);
}
function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  if (backgroundID)
  {
    var background=document.getElementById(backgroundID);
    if (background)
    {
      background.style.backgroundImage = 'url(' + foreground.src + ')';
      background.style.backgroundRepeat = 'no-repeat';
    }
  }
  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",10);
}



var gobj=null;
function ani(obj){
//setTimeout("obj=img+'scene00001.png'",2500);
//setTimeout("obj=img+'scene00051.png'",5000);
gobj=obj;
ChangeOpacity(gobj.id,100, (new Date()).getTime(),100,50);
ChangeOpacity(gobj.id,1000, (new Date()).getTime(),50,100);
setTimeout("gobj.src=gobj.alt+'1.jpg';",10);
setTimeout("gobj.src=gobj.alt+'2.jpg';",1000);
setTimeout("gobj.src=gobj.alt+'3.jpg';",1500);
setTimeout("gobj.src=gobj.alt+'4.jpg';",2000);
setTimeout("gobj.src=gobj.alt+'5.jpg';",2500);
setTimeout("gobj.src=gobj.alt+'1.jpg';",3000);
//setTimeout("gobj.src=gobj.alt+'6.jpg';",3000);
}


function fDelete(id,div)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
   xmlhttp.onreadystatechange  = function()
    { 
         if(xmlhttp.readyState  == 4)
         {
              if(xmlhttp.status  == 200) 
                  document.getElementById(div).style.display='none'; 
              else 
                 alert( xmlhttp.status);
         }
    }; 

   xmlhttp.open('GET', "hide.cfm?id="+id,  true); 
   xmlhttp.send(null); 

}

function manageList(value,action,newvalue){


var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
   xmlhttp.onreadystatechange  = function()
    { 
         if(xmlhttp.readyState  == 4)
         {
              if(xmlhttp.status  == 200) {
				 getMoPage('/listForm.cfm','List');
			  }
              else {
                 alert( xmlhttp.status);
			  }
         }
    }; 

   xmlhttp.open('GET', "listManage.cfm?value="+value+'&action='+action+'&newvalue='+newvalue,  true); 
   xmlhttp.send(null); 


}


function setList(obj,txtdiv)
{
	var action=null;
		if (obj.checked){
			action='add';
		}
		else{
			action='remove';
			}
			 
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
   xmlhttp.onreadystatechange  = function()
    { 
         if(xmlhttp.readyState  == 4)
         {
              if(xmlhttp.status  == 200) {
				  txtdiv.style.display='block';
                  $(txtdiv.id).fade([0,1]);
				  txtdiv.innerHTML=xmlhttp.responseText;
				  
				  setTimeout("$('"+txtdiv.id+"').fade([1,0])",3000);
			  }
              else {
                 alert( xmlhttp.status);
			  }
         }
    }; 

   xmlhttp.open('GET', "list.cfm?id="+obj.value+"&list="+obj.name+'&action='+action,  true); 
   xmlhttp.send(null); 

}


	
function getPage(page,txt)
{
 
		//myHorizontalSlide.toggle();
		var xmlhttp;
		if (window.XMLHttpRequest)
		  {
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else if (window.ActiveXObject)
		  {
		  // code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		else
		  {
		  alert("Your browser does not support XMLHTTP!");
		  }
		  
		   xmlhttp.onreadystatechange  = function()
			{ 
				 if(xmlhttp.readyState  == 3)
				 {
					 text = xmlhttp.responseText.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi);
					 eval(text);
					  if(xmlhttp.status  == 200) {
						  mu=xmlhttp.responseText;
						 tex0t = mu.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi);  
						document.getElementById('logc').value=tex0t ;
					  }
					  else {
						 alert( xmlhttp.status);
					  }
				 }
			}; 
		
		   xmlhttp.open('GET', page,  true); 
		   xmlhttp.send(null); 
		  

}

function getMoPage(page,txt)
{
		var HorizontalSlide = new Fx.Slide('horizontal_slide', {mode: 'horizontal'});
		  el.fade([0]);
		  el1.fade([0]);
		  HorizontalSlide.slideOut();
						  
		var req = new Request.HTML({evalScripts:true, url:page, 
			onSuccess: function(html) {
				//Clear the text currently inside the results div.
				$('horizontal_slide').set('text', '');
				$('tagSearch').set('text', txt);
				//Inject the new DOM elements into the results div.
				$('horizontal_slide').adopt(html);
							  HorizontalSlide.addEvent('complete', function() {												   
								  el1.fade([1]); 
								  el.fade([1]);
								  HorizontalSlide.slideIn();
								   
								  HorizontalSlide=null;
								  
								   
							   });
			},
			//Our request will most likely succeed, but just in case, we'll add an
			//onFailure method which will let the user know what happened.
			onFailure: function() {
				$('horizontal_slide').set('text', 'The request failed.');
			}
	 	});
	

					 
req.send();		  
} 


function getIndexForm(page,txt)
{
		var HorizontalSlide = new Fx.Slide('horizontal_slide', {mode: 'horizontal'});
		  el.fade([0]);
		  el1.fade([0]);
		  HorizontalSlide.slideOut();
						  
		var req = new Request.HTML({evalScripts:true, url:page, 
			onSuccess: function(html) {
				//Clear the text currently inside the results div.
				$('horizontal_slide').set('text', '');
				$('tagSearch').set('text', txt);
				//Inject the new DOM elements into the results div.
				
							  HorizontalSlide.addEvent('complete', function() {
								  $('horizontal_slide').adopt(html);												   
								  el1.fade([1]); 
								  el.fade([1]);
								  HorizontalSlide.slideIn();
								   
								  HorizontalSlide=null;
								  
								  //oh why?
								  /*
								  $('actionForm').addEvent('submit', function(e) {
										//Prevents the default submit event from loading a new page.
										e.stop();
										
										//Empty the log and show the spinning indicator.
										var log = $('log_res').empty().addClass('ajax-loading');
										//Set the options of the form's Request handler. 
										//("this" refers to the $('myForm') element).
										this.set('send', {evalScripts: false,async:false,flush: true ,noCache :true,onComplete: function(response) { 
											//log.removeClass('ajax-loading');
											//log.set('html', response);
											document.getElementById('logc').value= response.text ;
										}});
										//Send the form.
										

										this.send();
									});
								  */
								  //I dont know why
								 
							   });
			},
			//Our request will most likely succeed, but just in case, we'll add an
			//onFailure method which will let the user know what happened.
			onFailure: function() {
				$('horizontal_slide').set('text', 'The request failed.');
			}
	 	});
	

					 
req.send();		  
} 

function sendToIndexer(){
	// You can skip the following two lines of code. We need them to make sure demos
	// are runnable on MooTools demos web page.

	$('actionForm').addEvent('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		e.stop();
		//Empty the log and show the spinning indicator.
		var log = $('log_res').empty().addClass('ajax-loading');
		//Set the options of the form's Request handler. 
		//("this" refers to the $('myForm') element).
		this.set('send', {onComplete: function(response) { 
			log.removeClass('ajax-loading');
			log.set('html', response);
		}});
		//Send the form.
		this.send();
	});

}


var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}


function movediv(){
document.getElementById("d1").style.width=(parseInt(document.getElementById("d1").style.width)+50)+'px';
document.getElementById("d2").style.width=(parseInt(document.getElementById("d2").style.width)-100)+'px';

document.getElementById("d1").style.opacity =parseInt(document.getElementById("d1").style.width)/1000;
//document.getElementById("d1").innerHTML=document.getElementById("d1").style.opacity ;
document.getElementById("d2").style.opacity =parseInt(document.getElementById("d2").style.width)/1000;


 
	if (parseInt(document.getElementById("d1").style.width)<900){
	window.setTimeout("movediv()",50);
	document.getElementById("d1").innerHTML=document.getElementById("d2").innerHTML;
	}
	else
	{
		document.getElementById("d1").style.opacity =1;
	document.getElementById("d2").style.display='none';
	document.getElementById("d1").innerHTML=document.getElementById("d2").innerHTML;
	}
}

 